<?php ob_start();?>
<?php 
	$root = $_SERVER['DOCUMENT_ROOT'];
	/*TODO: burasi duzeltilecek*/
 	//include($root.'/standart/head.php');
 	include($root.'/standart/dateHeader.php');
 	include($root.'/standart/dbconnect.php');
 	$db = connect();
?>
<?php
session_start();
if(isset($_COOKIE['tzRemember'])){
	$_SESSION['id'] = $_COOKIE["gevezeUser"];
	$_SESSION['usr'] = $_COOKIE["gevezeMail"];
}
if(isset($_GET['logoff']))
{
	$_SESSION = array();
	session_destroy();
	setcookie("tzRemember","", time() -3600);
	setcookie("gevezeMail","", time() -3600);
	setcookie("gevezeUser","", time() -3600);
	header("Location: register.php");
	exit;
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Geveze Cafe | Kayıt</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--Google Fonts-->
<link href='http://fonts.googleapis.com/css?family=Oswald|Lato|Roboto:400,500,700|Open+Sans:600,700,300' rel='stylesheet' type='text/css'>
<!--Custom Css-->
<link href="css/custom.css" rel="stylesheet" type="text/css">
<!--Colors Css-->
<link href="css/colors_3.css" rel="stylesheet" type="text/css">
<!--Boostrap Css-->
<link href="css/bootstrap.css" rel="stylesheet" type="text/css">
<!--Boostrap-Responsice Css-->
<link href="css/bootstrap-responsive.css" rel="stylesheet" type="text/css">
<!--Calender Css-->
<link rel='stylesheet' type='text/css' href='css/fullcalendar.css' />
<!--Awesome Fonts-->
<link href="css/font-awesome.css" rel="stylesheet">
<!--Banner Slider-->
<link rel="stylesheet" href="css/flexslider.css" type="text/css" media="screen" />
<!--Scrollbar Css-->
<link href="css/jquery.mCustomScrollbar.css" rel="stylesheet" />
<!--Pie Chart Css-->
<link rel="stylesheet" type="text/css" href="css/style.css" media="screen">
<!--Date Picker-->
<link href="css/datepicker.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/slide.css" media="screen" />
<link href="css/tinyBox.css" rel="stylesheet" type="text/css" media="screen"/>
<!-- Html5 Js -->
<script src="js/html5.js" type="text/javascript"></script>

<script type="text/javascript">
function disableButton(){
	var name = document.getElementById('name');
    var surname = document.getElementById('surname');
    var email = document.getElementById('email');
    
    if(surname.value == paemailalue && surname.value != "" ){
    	if(name.value != ""){
	        $("#sbmBtn").attr("class", "pull-right continue_shopping button cbtn");
	        $("#sbmBtn").prop("disabled", false);
        }else{
        	$("#sbmBtn").attr("class", "pull-right checkout_btn checkout-button button alt");
            $("#sbmBtn").prop("disabled", true);
        }
    }
    else{
    	$("#sbmBtn").attr("class", "pull-right checkout_btn checkout-button button alt");
        $("#sbmBtn").prop("disabled", true);
    }
}
    function sentdata(){
    	var formData = $('#submitform').serialize();
    	$.ajax( {
        	url: "user-info-changed.php",
    		type: "POST",
    		data:  formData,
    		contentType: "application/x-www-form-urlencoded; charset=UTF-8",
    		success: function(data, textStatus, jqXHR){	
				if(data.trim().indexOf("Tebrikler")<0){ 
    				openNewUnit(data, 'error'); 
				}else{
					openNewUnit(data, 'success'); 
				}
			}}
		);
    }

  	</script>
</head>
<body>
<div id="toppanel">
	<div id="panel">
		<div class="content clearfix">
	        <?php
			if(!$_SESSION['id']):
			header("Location: index.php");
			exit;
			?>
			<div class="right">
				<!-- Login Form -->
				<form class="clearfix" action="" method="post" id="loginForm">
					
					<table style="border: none; width: 100%;">
						<tr>							
							<td>
								<input class="field" type="text" name="username" id="username" value="" size="23" placeholder="E-Mail"/>
							</td>
							<td>
								<input class="field" type="password" name="password" id="password" size="23" placeholder="Şifre" />
							</td>							
							<td>
								<a style="cursor: pointer;" onclick="forgetPass()">Şifremi Unuttum</a>
							</td>
						</tr>
						<tr>
							<td>
								<label><input name="rememberMe" id="rememberMe" type="checkbox" checked="checked" value="1" /> &nbsp;Beni hatırla</label>
							</td>
							<td>
								<input class="btn btn-success btn-xl" style="line-height: 12px; padding-left:30px; padding-right:30px;" type="button" name="submit" value="Giriş"  onclick="sendData()" />
							</td>
							<td>
								<input class="btn btn-info btn-lg"  value="Kayıt Ol" style="cursor: pointer; right: 0px; float: right; line-height: 12px;" type="button" onclick="window.location.replace('register.php')"/>
							</td>
						</tr>
					</table>
				</form>
			</div>
            <?php
			
			else:
			
			?>
            
            <div class="right">
            	<input class="btn btn-danger btn-xl" type="button" style="cursor: pointer; right: 0px; float: right; line-height: 12px; padding-right:30px; padding-left:30px;" onclick="window.location.replace('?logoff')" value="Çıkış"/>
            	<div class="loginTop"><?php echo $_SESSION['usr'] ? 'Merhaba '.$_SESSION['usr'] : '';?> <br/></div>
	            <div class="loginMenu">
	            	<div class="loginMenuLeft" onclick="window.location.replace('order-list.php')"> Siparişlerim </div>
	            	<div class="loginMenuMid" onclick="window.location.replace('user-info-change.php')"> Kişisel Bilgilerim </div>
	            	<div class="loginMenuMid" onclick="window.location.replace('add-address.php')"> Adres Ekle</div>
	            	<div class="loginMenuRight" onclick="window.location.replace('change-password.php')"> Şifre Değiştir </div>
	            </div>
            </div>
            <?php
			endif;
			?>
		</div>
	</div> <!-- /login -->	
    <!-- The tab on top -->	
	<div class="tab">
		<ul class="login">
	    	<li class="left">&nbsp;</li>
	        <li id="toggle">
				<a id="open" class="open" href="#"><?php echo $_SESSION['id']?'Kullanıcı Bilgileri':'Üye Girişi | Yeni Üye';?></a>
				<a id="close" style="display: none;" class="closex" href="#">Bilgi Alanını Kapat</a>			
			</li>
	    	<li class="right">&nbsp;</li>
		</ul> 
	</div> <!-- / top -->
</div> <!--panel -->
<!--Wrapper Start-->
<div id="wrapper"> 
  <!--Header Start-->
<header id="header"> <!--<span class="icon-dish"></span>-->
    <div class="container">
      <div class="row-fluid">
        <div class="span3">
          <div class="logo"><a href="index.php"><img src="images/logo-gevezecafe.png" alt="img"></a></div>
        </div>
        <div class="span8 margin-non">
          <div class="top-container">
            <div class="span5"></div>
            <div class="span7">
             </div>
          </div>
          <div class="navbar navbar-inverse nav-bar">
            <div class="navbar-inner nav-bar-inner">
              <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
              <div class="nav-collapse collapse top-nav">
                <ul class="nav">
                  <li class="dropdown"> <a class="dropdown-toggle" href="index.php">ANA SAYFA</a>
                  </li>
                  <li class="dropdown"> <a class="dropdown-toggle" href="menu.php" >MENÜ</a>
                  </li>
                  <li class="dropdown"> <a class="dropdown-toggle" href="404.php" >SEPETİM</a>
                  </li>
				  <li class="dropdown"> <a class="dropdown-toggle" href="about.php" >HAKKIMIZDA</a>
                  </li>
                  <li class="dropdown"> <a class="dropdown-toggle" href="contact.php" >İLETİŞİM</a></li>
                </ul>
              </div>
              <!--/.nav-collapse --> 
            </div>
            <!-- /.navbar-inner --> 
          </div>
          <!--Nav End--> 
        </div>
      </div>
    </div>
  </header>
  <!--Header End--> 
  
  <!--Banner Start-->
  <section id="banner" class="height">
    <div class="contact-banner"><img src="images/1600x182.jpg" alt="img"></div>
  </section>
  <!--Banner End-->
    <section id="content" class="container"> 
    <!--Blog Page Section Start-->


  <!--Content Area Start-->
  <section id="content" class="container"> 
    <section class="blog-page-section">
      <div class="row-fluid">
        <div class="span12">
          <div class="heading">
            <h1 style="font-family: helvatica;">Bilgi Güncelleme</h1>
          </div>
        </div>        
      </div>
    </section>
    
    <!--Form Section Start-->
    <?php 
	    $userInfoQuery = "SELECT ID, ISFIRM, NAME, SURNAME, EMAIL, RELATED_FIRM, CELL_PHONE, PHONE FROM GEVEZE_USER WHERE ID = ".$_SESSION["id"];
	    $userInfoList = $db->query($userInfoQuery) or die($userInfoQuery."<br/><br/>".mysql_error());
	    
	    if($list = $userInfoList->fetch_assoc()){
			$id = $list['ID'];
			$isFirm = $list['ISFIRM'];
			$name = $list['NAME'];
			$surname = $list['SURNAME'];
			$email = $list['EMAIL'];
			$relatedFirm = $list['RELATED_FIRM'];
			$cellPhone = $list['CELL_PHONE'];
			$phone = $list['PHONE'];
		}
    ?>
    <section class="contact-form-section" >
      <div class="row-fluid" >
        <div class="span8">
          <div class="contact-form">
            <form id="submitform" role="form" action="password-change-sent.php" method="post">
             <table class="table">
             	<tbody class="erdem-table">
             		<tr style="border-style: hidden;">
             			<td colspan="2">
             			<?php if ($isFirm != "N"){?>
             				<input type="radio" name="isfirm" id="firm" value="Y" checked="checked" disabled="disabled">Tüzel Kişi</input>
             				<input type="radio" name="isfirm" id="person" value="N"  style="margin-left: 30px;" disabled="disabled"/>Özel Kişi</input>
             				<?php }
             				else{ ?>
             				<input type="radio" name="isfirm" id="firm" value="Y"  disabled="disabled">Tüzel Kişi</input>
             				<input type="radio" name="isfirm" id="person" value="N" checked="checked" style="margin-left: 30px;" disabled="disabled"/>Özel Kişi</input>
             				<?php }?>
             			</td>
             		</tr>
             		<tr style="border-style: hidden;" >
             			<td class="erdem-td" id="nameLabel">İsminiz</td>
             			<td><input style="width: 75%" class="form-control" type="text" required pattern="[a-zA-Z ]+" name="name" maxlength="100" placeholder="İsminiz" id="name" value="<?php echo $name; ?>"> </td>
             		</tr>
             		<?php if ($isFirm == "N"){?>
		            <tr style="border-style: hidden;" id="lastnameTr">
		             	<td class="erdem-td">Soyadınız</td>
		             	<td><input style="width: 75%" class="form-control" type="text" required pattern="[a-zA-Z ]+" name="lastname" maxlength="100" placeholder="Soyadınız" id="surname"  value="<?php echo $surname; ?>"> </td>
		            </tr>
		            <?php }?>
		            <tr style="border-style: hidden;">
		            	<td class="erdem-td">Email Adresiniz</td>
		             	<td><input style="width: 75%" class="form-control" type="text" required pattern="^[a-zA-Z0-9-\_.]+@[a-zA-Z0-9-\_.]+\.[a-zA-Z0-9.]{2,5}$" name="email" maxlength="150" placeholder="Email" id="email"  value="<?php echo $email; ?>"> </td>
		            </tr>
		            <?php if ($isFirm == "N"){?>
		            <tr style="border-style: hidden;" id="firmTr">
		             	<td class="erdem-td">Şirket</td>
		             	<td>		             	
		             		<select class="form-control" id="selectBox" name="firmId" onchange="callContent(this.value)" style="width: 75%">
             			       <?php 
		             				$firmNameQuery = "SELECT NAME FROM GEVEZE_USER WHERE ID = ".$_SESSION["id"];
		             				$firmNameList = $db->query($firmNameQuery) or die($firmNameQuery."<br/><br/>".mysql_error());
		             			?>
		             			<?php if($firm = $firmNameList->fetch_assoc()){ ?>
             						<option value="0"><?php echo $firm['NAME']; ?></option>
             					<?php } 
             					
	             					$firmQuery = "SELECT ID, NAME FROM GEVEZE_USER WHERE ISFIRM = 'Y' AND ISACTIVE = 'Y' AND ISDELETED = 'N'";
			             			$firmList = $db->query($firmQuery) or die($firmQuery."<br/><br/>".mysql_error());
		             			?>
             					<?php while($firm = $firmList->fetch_assoc()){ ?>
             						<option value="<?php echo $firm['ID']; ?>"><?php echo $firm['NAME']; ?></option>
             					<?php } ?>             					
		             		</select> 
		             	</td>
		             </tr>
		              <?php }?>
		             <tr style="border-style: hidden;">
			             <td class="erdem-td">Cep Tel</td>
			             <td><input style="width: 75%" class="form-control" type="text" name="cellphone" id="cellphone"   value="<?php echo $cellPhone; ?>" ></td>
		             </tr>
              		<tr style="border-style: hidden;">
             			<td class="erdem-td">İş Tel</td>
             			<td><input style="width: 75%" class="form-control" type="text" name="phone" id="phone"  value="<?php echo $phone; ?>"></td>
             		</tr>              		
					    
					<tr>
             <td>
             </td>
             <td >
             	<ul>
	             	<li class="span3 margin-non" style="float: right; margin-right: 25% !important;">
	                  <input type="button" onclick="sentdata()" name="sbmBtn" value="Güncelle" id="sbmBtn" class="pull-right continue_shopping button cbtn">
	                </li>
                </ul>
             </td>
             </tr>                  
             	</tbody>
             </table>
             
            </form>
          </div>
        </div>

        <div class="span4">
          <div class="address-box">
            <div class="head">
              <h3 style="font-family: Helvatica;">Adresimiz</h3>
              <span class="location">location</span> </div>
            <div class="address-area">
              <ul>
                <li class="location" style="font-family: Open-Sans;">IYTE TEKNOPARK A1 BİNASI<br>
                  URLA/IZMIR</li>
                <li class="call"> <strong class="phone"  style="padding-top: 5px; font-family: 'Open-Sans'">0232 765 9095</strong> </li>
                <li class="email"> <a href="mailto:iletisim@gevezecafe.com" class="email" style="padding-top: 5px;">iletisim@gevezecafe.com</a> <span class="small"></span> </li>
              </ul>
            </div>
          </div>
        </div>
		<section class="opening-section">
                <div class="span4" style="margin-left: 30px;">
          <div class="opening-hours-box">
            <div class="head">
              <h2>Çalışma Saatlerimiz</h2>
              <span class="watch"></span> </div>
            <div class="chart-sheet">
              <ul>
                <li> <strong class="day">Haftaiçi</strong> <strong class="time">08:00 - 19:00</strong> </li>
                <li class="opening-active"> <strong class="day">Haftasonu</strong> <strong class="time">Kapalı</strong> </li>
              </ul>
            </div>
          </div>
        </div>
            </section>
      </div>
    </section>
    <!--Form Section End--> 
  </section>
  <!--Content Area End--> 
</section>
          
          
 
  <!--Footer Area Start-->
  <footer id="footer">
    <div class="row-fluid">
      <section class="footer-section-1">
        <div class="bg-opacity-2">
          <div class="container">
            <div class="span3">
              <div class="featured-dishes">
                <h4>Sizin İçin Seçtiklerimiz</h4>
				<ul>
				<?php
				
				$featuredQuery ="SELECT * FROM MENU WHERE ID IN (SELECT MENU_ID FROM MENU_FEATURE WHERE ISFEATURED='E')";
				$featuredMenuList = $db->query($featuredQuery) or die($featuredQuery."<br/><br/>".mysql_error());
				$rows = 0;
				while($featuredMenu = $featuredMenuList->fetch_assoc()){
					if(is_null($featuredMenu['PICTURE'])){
						$menuImg = "images/featured-footer-img-1.jpg";
					}
					else{
						$menuImg = $featuredMenu['PICTURE'];
					}
				?>
					<li>
						<div class="frame"><img src="<?php echo $menuImg; ?>" style="width: 113px; height: 50px;" alt="img"></div>
						<div class="text"> <strong class="title"><?php echo $featuredMenu['PRODUCT_NAME'];?></strong> </div>
					</li>
				<?php
					$rows++;
					if($rows==3){
						break;
					}
				}
				disconnect($db);
				?>
				</ul>
              </div>
            </div>
            <div class="span1">
            </div>
			<div class="span2">
              <div class="recent-post">
                <div class="featured-dishes">
                  <h4>Site Haritası</h4>
                  <ul>
                    <li class="site-map">
                      <div id="address" class="recent-post-text"> <strong class="title"><a href="index.php">Ana Sayfa</a></strong></div>
                    </li>
                    <li class="site-map">
                      <div id="address" class="recent-post-text"> <strong class="title"><a href="menu.php">Menü</a></strong></div>
                    </li>
                    <li class="site-map">
                      <div id="address" class="recent-post-text"> <strong class="title"><a href="menu.php">Sepetim</a></strong></div>
                    </li>
                    <li class="site-map">
                      <div id="address" class="recent-post-text"> <strong class="title"><a href="about.php">Hakkımızda</a></strong></div>
                    </li>
                    <li class="site-map">
                      <div id="address" class="recent-post-text"> <strong class="title"><a href="contact.html">İletişim</a></strong></div>
                    </li>
                  </ul>
                </div>
              </div>
            </div> 			
            <div class="span3">
              <div class="recent-post">
                <div class="featured-dishes">
                  <h4>Adres</h4>
                  <ul>
                    <li>
                      <div id="address" class="recent-post-text"> <strong class="title">IYTE Teknopark, Gülbahçe<br/>Urla İzmir</strong> </div>
                    </li>
                    <li>
                      <div id="phone" class="recent-post-text"> <strong class="title">Telefon: 0232 765 90 95<br/></strong> </div>
                    </li>
                    <li>
                      <div id="email" class="recent-post-text"> <strong class="title">Email: info@gevezecafe.com</strong> </div>
                    </li>
                  </ul>
                </div>
              </div>
            </div>           
            <div class="span3">
              <div class="watch-box">
                <div class="watch-img"> <img src="images/watch-img.png" alt="img">
                  <div class="time-box"> <strong class="time">Hafta İçi Her Gün</strong> <strong class="time">08:00 - 19:00</strong> </div>
                </div>
                <strong class="book-table">Siparişleriniz İçin: <span class="red">0232 765 9095</span></strong> 
              </div>
            </div>
          </div>
        </div>
      </section>
      <!--Footer Section Section 3 Start-->
      <section class="footer-section-3">
        <div class="container">
          <div class="span6">
            <div class="copy-section"><strong class="copy">&copy; 2014 Teknopark Geveze Cafe, Designed by <a href="http://gevezecafe.com/" class="link" target="_blank">gevezecafe.com</a></strong></div>
          </div>
          <div class="span6">
            <div class="footer-social-box">
              <ul>
                <li class="social-icon-1"><a href="#">p</a></li>
                <li class="social-icon-2"><a href="#">twitter</a></li>
                <li class="social-icon-3"><a href="#">facebook</a></li>
                <li class="social-icon-4"><a href="#">facebook</a></li>
                <li class="social-icon-5"><a href="#">facebook</a></li>
                <li class="social-icon-6"><a href="#">facebook</a></li>
              </ul>
            </div>
          </div>
        </div>
      </section>
      <!--Footer Section Section 3 End--> 
    </div>
  </footer>
  <!--Footer Area End--> 
  <p id="back-top"> <a href="#top" class="back-top">Back to Top</a> </p>
</div>   
<div id="invisDiv" style="display: none;"></div>
<!-- jQuery --> 
<script type="text/javascript" src="js/jquery.js"></script><!-- jQuery lib Js --> 

<!-- Bootstrap --> 
<script src="js/bootstrap.min.js" type="text/javascript"></script><!-- Boostrap Js --> 

<!-- FlexSlider --> 
<script defer src="js/jquery.flexslider.js"></script><!-- FlexSlider --> 

<!-- Custom Scripts --> 
<script src="js/custom.js" type="text/javascript"></script><!-- Custom Scripts --> 

<!-- Calender --> 
<script type='text/javascript' src='js/jquery-ui-1.8.23.custom.min.js'></script><!-- Calender Js--> 
<script type='text/javascript' src='js/fullcalendar.js'></script><!-- Calender Js--> 

<!--Google Map--> 
<script type="text/javascript" src="js/google.map.js"></script> 

<!--Date Picker Js--> 
<script src="js/bootstrap-datepicker.js"></script><!--Date Picker Js--> 
<script type="text/javascript" src="js/tinybox.js"></script>

<script type="text/javascript" src="../js/ajax.js"></script>
<script type="text/javascript" src="cart/cart.js"></script> 
<script type="text/javascript" src="js/login.js"></script>
<script src="js/jquery.maskedinput.min.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
	   $("#cellphone").mask("(999)-999-9999",{placeholder:"_"});
	   $("#phone").mask("(999)-999-9999",{placeholder:"_"});
	   $("#capctha").mask("*****",{placeholder:" "});
	});

$("input[name=isfirm]:radio").change(function () {
	if($('#firm').is(':checked')) { 
    	 $('#nameLabel').html('Ünvan');
    	 $('#lastnameTr').css('display','none');
    	 $('#firmTr').css('display','none');
   	}
	if($('#person').is(':checked')) { 
		$('#nameLabel').html('İsminiz');
		$('#lastnameTr').css('display',''); 
		$('#firmTr').css('display',''); 
	}
});


function openNewUnit(htm, type) {
	TINY.box.show({html:htm,close:false,boxid:type,top:20});
// 	setTimeout(function(){closeBox()}, 5000);
}

function closeBox() {
	TINY.box.hide();
}
</script>

<!--Wrapper End-->
</body>
</html>
<?php ob_flush(); ?>